package com.tanhua.admin.task;

import com.tanhua.admin.service.AnalysisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author HuangRongFu
 * 2021/11/30 星期二10:33 上午
 */

@Component
@Slf4j
public class AnalysisTask {

    @Autowired
    private AnalysisService analysisService;

    //    @Scheduled(cron = "0/2 * * * * ?")
    //initialDelay 启动后多少s执行  fixedRate 多久执行一次
    @Scheduled(initialDelay = 3000, fixedRate = 1800000)
    private void analysis() {

        log.info("后台数据统计任务开始执行");

        analysisService.analysis();

        log.info("后台数据统计完成!!!!!");
    }
}
